import Vue from 'vue'
import Router from 'vue-router'

Router.prototype.replace = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const originalReplace = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalReplace.call(this, location).catch(err => err)
}

Vue.use(Router)

export default new Router({
  routes: [
    {
      path:'/QSLoading',//勤瘦小程序 - 通用页面
      name: 'QSLoading',
      component: () => import('@/views/QSLoading.vue'),
    },
    {
      path:'/QSControl',//勤瘦小程序 - 通用页面
      name: 'QSControl',
      component: () => import('@/views/QSControl.vue'),
      children:[
        {
          path:'/QSUserInfo',//勤瘦小程序 - 后管配置 - 用户信息列表
          name: 'QSUserInfo',
          component: () => import('@/views/QSUserInfo.vue'),
        },
        {
          path:'/QSPublicInfo',//勤瘦小程序 - 后管配置 - 公共信息
          name: 'QSPublicInfo',
          component: () => import('@/views/QSPublicInfo.vue'),
        },
        {
          path:'/QSHomePage',//勤瘦小程序 - 后管配置 - 首页
          name: 'QSHomePage',
          component: () => import('@/views/QSHomePage.vue'),
        },
        {
          path:'/QSInformationList',//勤瘦小程序 - 后管配置 - 资讯
          name: 'QSInformationList',
          component: () => import('@/views/QSInformationList.vue'),
        },
        {
          path:'/QSInformation',//勤瘦小程序 - 后管配置 - 资讯
          name: 'QSInformation',
          component: () => import('@/views/QSInformation.vue'),
        },
        
        {
          path:'/QSMakeFoods',//勤瘦小程序 - 后管配置 - 自由日食谱
          name: 'QSMakeFoods',
          component: () => import('@/views/QSMakeFoods.vue'),
        },
        {
          path:'/QSFoodsList',//勤瘦小程序 - 后管配置 - 自由日食谱
          name: 'QSFoodsList',
          component: () => import('@/views/QSFoodsList.vue'),
        },
        {
          path:'/QSShareSetting',//勤瘦小程序 - 后管配置 - 分享页配置
          name: 'QSShareSetting',
          component: () => import('@/views/QSShareSetting.vue'),
        },
        {
          path:'/QSExchangeMall',//勤瘦小程序 - 后管配置 - 兑换商城
          name: 'QSExchangeMall',
          component: () => import('@/views/QSExchangeMall.vue'),
        },
        {
          path:'/QSProblemAndHelp',//勤瘦小程序 - 后管配置 - 常见问题及帮助
          name: 'QSProblemAndHelp',
          component: () => import('@/views/QSProblemAndHelp.vue'),
        },
        {
          path:'/QSSendMessage',//勤瘦小程序 - 后管配置 - 发送短信
          name: 'QSSendMessage',
          component: () => import('@/views/QSSendMessage.vue'),
        },
        
        {
          path:'/QSElement',//勤瘦小程序 - 通用页面
          name: 'QSElement',
          component: () => import('@/views/QSElement.vue'),
        },
        {
          path: "",
          redirect: "/QSUserInfo",
        }  
      ]
    },
		{
			path: "*",
      redirect: "/QSLoading",
		}  
                                             
  ]
})
